import Vue from 'vue'
import VueI18n from 'vue-i18n'
import store from '../store'
// import moment from 'moment'

// default lang
import zhCn from './lang/zh-CN'
import enUs from './lang/en-US'

Vue.use(VueI18n)
console.log(store.getters.lang);
export const defaultLang = store.getters.lang || 'zh-cn'

export const lang = {
  'en-us': 'English',
  'zh-cn': '中文'
}



const messages = {
  'zh-cn': {
    ...zhCn
  },
  'en-us':{
    ...enUs
  }
}

const i18n = new VueI18n({
  silentTranslationWarn: true,
  locale: defaultLang,
  fallbackLocale: defaultLang,
  messages
})


export default i18n
